<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/includes.jsp" %>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>采购(原材料/成品)入库编辑</title>
	<%@ include file="/common/metaInput.jsp" %>  
	<script src="${ctx}/js/jsp/comm.js" type="text/javascript"></script>
	<script type="text/javascript" src="${ctx}/js/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript" src="${ctx}/js/jsp/yd/logic/ItemStateData.js"></script>
	<script src="${ctx}/js/jsp/date.js" type="text/javascript"></script>
	
<script type="text/javascript">
var basic_Url="${ctx}/logic/purchaseware";
var compay_Url="${ctx}/logic/purchasereturn";
var print=false; //是否打印的状态标识 true 为打印  在 点击提交的时候进行打印
var grid;
var obj;
	$(function(){
		obj={'zd019AccountName':$('#zd019AccountName').val(),'zd018TheSumMoney':$('#zd018TheSumMoney').val(),'zd007WhName':$('#zd007WhName').val(),'zd008SupeName':$('#zd008SupeName').val(),'zd017MaterialInCode':$('#zd017MaterialInCode').val(),'zd016PiCode':$('#zd016PiCode').val(),'zd013Date':$('#zd013Date').val(),'zd014Remark':$('#zd014Remark').val(),'zd003Code':$('#zd003Code').val(),'bizCreatorName':$('#bizCreatorName').val(),'zd011Atten':'${userName}'};
		$("#inputForm").validate({			   
			onsubmit: true,
		 /*执行ajaxsubmit  */ 
		    submitHandler: function(editform) {
		        try{			    		
		            url =  basic_Url+"/save.do";
		            var api = frameElement.api;
		        	var W = api.opener;zd007WhName
		        	getReturnMessageThree(url,"inputForm",W.searchAP,"",obj,getNeedData(grid.getData()),print,"purchaseware");
		        }catch(e){alert(e);}
		    }
		});
		//单据的状态
		var billSt = '${pcsware.zd004Status}';
		var column1 = [{ display : 'id', name : 'id', hide : true},
					{ display: '物料id', name: 'zd003MaterId', hide : true },
					{ display: '<font color="gray">物料编码</font>', name: 'zd004Code', width: 120},
	                { display: '<font color="gray">物料名称</font>', name: 'zd005Name', width: 180 },
	                { display: '产品型号<font color="red">*</font>', name: 'zd007Model', width: 100 },
  				  	{ display: '产品尺寸<font color="red">*</font>', name: 'zd011Size', width: 100 },
  				    { display: '产品颜色<font color="red">*</font>', name: 'zd009Color', width: 80 },
  				    { display: '产品材质<font color="red">*</font>', name: 'zd010Quality', width: 160 },
	                { display: '单位<font color="red"></font>', name: 'zd012Unit', width: 100 },
	               
	                { display: '<font color="gray">订单数量</font>', name: 'zd014Quatity', width: 100},
	                { display: '<font color="gray">已入库数量</font>', name: 'zd022InQuantity', width: 120},
	                { display: '入库数量<font color="red">*</font>', name: 'zd018HsQuantity', width: 120, editor :{type : 'float'},render:function(item){
                   		var price = item.zd016Price;//单价
                   		var zdnum = item.zd018HsQuantity;//数量
                   		//alert(price);alert(zdnum);
                   		if((!isNaN(price)&&price!=''&&price!=null&&price!=undefined) && (!isNaN(zdnum)&&zdnum!=''&&zdnum!=null&&zdnum!=undefined)){
                   			item.zd025SumMoney = (parseFloat(price)*parseFloat(zdnum)).toFixed(4);
                   			getSumMoney();
                   		}
                   		
                   		if(undefined==zdnum||zdnum==''||zdnum==null){
                   			if(item.zd022InQuantity==undefined||item.zd022InQuantity==null||item.zd022InQuantity==''){
                   				item.zd018HsQuantity=item.zd014Quatity;
                   			}else{
                   				item.zd018HsQuantity=item.zd014Quatity-item.zd022InQuantity;
                   			}
                   			
                   			
                   		}
                	 	return item.zd018HsQuantity.toFixed(4);
                 	}},
                 	 { display: '单价<font color="red">*</font>', name: 'zd016Price', width: 100,editor:{type:'float'},render:function(item){
                    		var price = item.zd016Price;//单价
                    		var zdnum = item.zd018HsQuantity;//数量
                    		if((!isNaN(price)&&price!=''&&price!=null&&price!=undefined) && (!isNaN(zdnum)&&zdnum!=''&&zdnum!=null&&zdnum!=undefined)){
                    			item.zd025SumMoney = parseFloat(price)*parseFloat(zdnum).toFixed(4);
                    			getSumMoney();
                    		}
                 	 	return price==null?'0':(1*price).toFixed(4);
                  	}},
                 	{ display: '<font color="gray">已反审数量</font>', name: 'zd020BackQuantity', width: 120,render:function(item){
                 		if(isNaN(item.zd020BackQuantity)){
                 			return '0.00';
                 		}else{
                 			return item.zd020BackQuantity;
                 		}
                 	}},
	                { display: '总金额<font color="red">*</font>', name: 'zd025SumMoney', width: 120},
	                { display: '<font color="gray">描述</font>', name: 'zd024Descript', width: 245 , editor :{type : 'text'} }];
		
		var column2 = [ { display : 'id', name : 'id', hide : true},
						{ display: '物料id', name: 'zd003MaterId', hide : true },
						{ display: '<font color="gray">物料编码</font>', name: 'zd004Code', width: 120},
		                { display: '<font color="gray">物料名称</font>', name: 'zd005Name', width: 180 },
		                { display: '产品型号<font color="red">*</font>', name: 'zd007Model', width: 100 },
	  				  	{ display: '产品尺寸<font color="red">*</font>', name: 'zd011Size', width: 100 },
	  				    { display: '产品颜色<font color="red">*</font>', name: 'zd009Color', width: 80 },
	  				    { display: '产品材质<font color="red">*</font>', name: 'zd010Quality', width: 160 },
		                { display: '单位<font color="red"></font>', name: 'zd012Unit', width: 100 },
		                { display: '<font color="gray">订单数量</font>', name: 'zd014Quatity', width: 100},
		                { display: '<font color="gray">已入库数量</font>', name: 'zd022InQuantity', width: 120},
		                { display: '入库数量<font color="red">*</font>', name: 'zd018HsQuantity', width: 120},
		                { display: '单价<font color="red">*</font>', name: 'zd016Price', width: 100 },
		                { display: '<font color="gray">已反审数量</font>', name: 'zd020BackQuantity', width: 120,render:function(item){
	                 		if(isNaN(item.zd020BackQuantity)){
	                 			return '0.00';
	                 		}else{
	                 			return item.zd020BackQuantity;
	                 		}
	                 	}},
		                { display: '总金额<font color="red">*</font>', name: 'zd025SumMoney', width: 120},
		                { display: '<font color="gray">描述</font>', name: 'zd024Descript', width: 245, editor :{type : 'text'} }
		                ];
		var colunm3 = null;
		if(''==billSt && 'ADD'=='${flag}'){
			//新增
			column3 = column1;
		}else{
			if('PCSW_SAVE'==billSt||'PCSW_BACK'==billSt){
				column3 = column1;
		    }else{
		    	column3 = column2;
		    }
		}
		grid = $("#table1").ligerGrid({
        	columns: column3,
        	enabledEdit: true,
            usePager: true,pageSize:1000,pageSizeOptions:[1000],
            parms:[{ name : 'id' , value : '${pcsware.id}'}],
            url : basic_Url+"/gridItems.do",
            width: "100%", height:250, checkbox: true,rownumbers:true,
            toolbar: { items: [{ text: '删除', click: deleteRow, img: '${ctx}/js/ligerUI/skins/icons/delete.gif' }]}
        });
	
		$("#pageloading").hide();
		
		//按钮可见/不可见
		if(billSt=='' || '${flag}'=='ADD'){
			//新增
			$("#forExcel").hide();
			$("#forSubmit").hide();
			$("#forBack").hide();
			$("#forAudit").hide();
			$("#forAuditEnd").hide();
			$("#forApproved").hide();
			$('#print1').hide();
			$('#print2').hide();
		}else if(billSt=='PCSW_SAVE'){
			//暂存
			$("#forExcel").hide();
			$("#forSave").hide();
			$("#forBack").hide();
			$("#forAudit").hide();
			$("#forAuditEnd").hide();
			$("#forApproved").hide();
		}else if(billSt=='PCSW_SUBMIT'){
			//已提交待二审
			$("#forExcel").hide();
			$("#forSave").hide();
			$("#forSubmit").hide();
			$("#forApproved").hide();
		}else if(billSt=='PCSW_AUDIT'){
			//已二审待三审
			$("#forExcel").hide();
			$("#forSave").hide();
			$("#forSubmit").hide();
			$("#forAudit").hide();
			$("#forAuditEnd").hide();
		}else if(billSt=='PCSW_APPROVE'){
			//已三审
			$("#deleteBack").hide();
			$("#forExcel").hide();
			$("#forSave").hide();
			$("#forSubmit").hide();
			$("#forAudit").hide();
			$("#forAuditEnd").hide();
			$("#forApproved").hide();
			$("#forBack").hide();
		}else if(billSt=='PCSW_BACK'){
			//已驳回
			$("#forExcel").hide();
			$("#forSave").hide();
			$("#forBack").hide();
			$("#forAudit").hide();
			$("#forAuditEnd").hide();
			$("#forApproved").hide();
		}else{
			$("#deleteBack").hide();
		}
	});
	//取得总金额
	function getSumMoney(){
		var zdTheSumMoney = '0';
		var cRows = grid.getData();
		for(var i=0; i<cRows.length; i++){
			var cRow = cRows[i];
			var sumMoney = cRow.zd025SumMoney;
			if(sumMoney==null||sumMoney==''||sumMoney==undefined||isNaN(sumMoney)){
				sumMoney = '0';
			}
			zdTheSumMoney = parseFloat(zdTheSumMoney)+parseFloat(sumMoney);
		}
		$("#zd018TheSumMoney").val(zdTheSumMoney.toFixed(4));
	}
	
	//提交按钮
	function submitForm(param){
		var data = grid.getData();
		var money=0; //金额
		var dl=grid.getDeleted();
		if(data.length==0){
			$.dialog.alert("请选择申请物料");
	   	 	return false;
		}
		var ba=true;
		if(data !=null){
			var i=0;
			$(data).each(function (){
				i++;
				if(isNaN(this.zd016Price)||this.zd016Price==undefined ||this.zd016Price==null||this.zd016Price<=0){
					ba=false;
					$.dialog.alert("您第" + i + "行的单价没有填写,或者填写错误(单价不能为0)");
					return false;
				}
				if(isNaN(this.zd018HsQuantity) ||this.zd018HsQuantity==undefined ||this.zd018HsQuantity==null) {
					ba = false;
					$.dialog.alert("您第" + i + "行的数量没有填写");
					return false;
				}
				if (this.zd018HsQuantity <= 0) {
					$.dialog.alert("您第" + i + "行的入库数量不能小于等于0");
					ba = false;
					return false;
				}else{
					if (this.zd022InQuantity == null){
						this.zd022InQuantity = 0;
					}
					if(this.zd018HsQuantity== null){
						this.zd018HsQuantity = 0;
					}
					if(parseFloat(this.zd018HsQuantity)>parseFloat(this.zd014Quatity)){
						$.dialog.alert("您第" + i + "行的入库数量大于订单数量");
						ba = false;
						return false;
					}
					if (parseFloat(parseFloat(this.zd014Quatity - this.zd022InQuantity)).toFixed(4)< parseFloat(parseFloat(this.zd018HsQuantity).toFixed(4))){
						$.dialog.alert("您第" + i + "行的入库数量大于订单未入库数量");
						ba = false;
						return false;
					}
				}
			});
		}
		jQuery.ajaxSettings.async = false;
		if(param=='PCSW_APPROVE'){
			getDG().dialog({content: "是否审核完结请选择(Yes或者No)!",width: 250,lock: true,max: false,min: false,
			title:'Confirm Infor',
			button: [{
		             name: 'Yes',
		             callback: function(){
		            	 if (ba){
		            		 $("#flagMark").val(param);
			     			 $("#itemdata").val(JSON.stringify(data));
			     			 $("#itemdelete").val(JSON.stringify(dl));
			     			 $("#inputForm").submit();
			     		 }
			         }},
		         	 {
			        	 name: 'No',
		        	   	 focus: true
		         	 }]
			}).zindex();
		}else{
			if (ba) {
				$("#flagMark").val(param);
				$("#itemdata").val(JSON.stringify(data));
				$("#itemdelete").val(JSON.stringify(dl));
				if(param=='PCSW_SUBMIT'){
					print=true;
				}
				$("#inputForm").submit();
		}
		}
	}
//仓库
	function  SotrageinfoWindow() {
		getDG().dialog(
				{
					title : '选择仓库',
					width : 650,
					height : 350,
					content : 'url:' + sys_context + '/public/windowalert/sotrageinfo.do?roleQuery=y',    
					lock : true,
					max : true,
					min : true,
					ok : function() {
						var rows = this.content.getSelected();
						if(rows==null){
							$.dialog.alert("请选择数据");
							return;
						}
						else{
							if(rows.length>1){
								$.dialog.alert('只能选择一行数据!');
								return;
							}else{
								$(rows).each(function() {
									$("#zd005WhId").val(this.id);
									$("#zd006WhCode").val(this.zd002Code);
									$("#zd007WhName").val(this.zd003Name);
							  });
							}
						}
						this.content.Close();
						return false;
					},
					cancelVal : '关闭',
					cancel : true
				}).zindex();
	}
	//采购订单编号
	function PurchaseReturnWindow() {
		getDG().dialog({
			title : '选择采购单',
			width : 800,
			height : 350,
			content : 'url:' + sys_context + '/public/windowalert/purchase.do', 
			lock : true,
			max : true,
			min : true,
			ok : function() {
				var rows = this.content.getSelected();
				
				if(rows==null){
					$.dialog.alert("请选择数据");
					return;
				}
				else{
					if(rows.length>1){
						$.dialog.alert('只能选择一行数据!');
						return;
					}else{
						$(rows).each(function() {
							$("#zd002PcsCode").val(this.zd020Code);
							$("#zd001PcsId").val(this.id);
							
							$("#zd009PayId").val(this.zd005PayId);
							$("#zd009PayCode").val(this.zd005PayCode);
							$("#zd009PayName").val(this.zd005PayName);
							
							$("#zd010DeptId").val(this.zd008DeptId);
							$("#zd010DeptCode").val(this.zd009DeptCode);
							$("#zd010DeptName").val(this.zd010DeptName);
							
							$("#zd015BuyWay").val(this.zd018BuyWay);
							$("#zd016PiCode").val(this.zd012PiCode);
							
							$("#zd019AccountID").val(this.zd022AccountID);
							$("#zd019AccountName").val(this.zd022AccountName);
							$("#zd019AccountCode").val(this.zd022AccountCode);
							$.ajax({
								url: sys_context + "/public/windowalert/rscompany.do",
								global: false,
								type: "POST",
								dataType: "json",
								data: ({
									purid : this.id
								}),		     
								success: function(msg){
									if(undefined != msg && undefined != msg.compay && null != msg.compay){
										$("#zd008SupeName").val(msg.compay.zd003ZhName);
										$("#zd008SupeId").val(msg.compay.id);
										$("#zd008SupeCode").val(msg.compay.zd001Code);
										multipleSearch("#table1",true,"",basic_Url+"/pcsItems.do?pcsId="+$("#zd001PcsId").val());
									}else{
										alert("返回对象为空");
									}
								}
							 });
						}
						);
					}
				}
				
				this.content.Close();
				return false;
			},
			cancelVal : '关闭',
			cancel : true
		}).zindex();
	}


	function deleteRow() {
		if('${po.billstatus}' != "" && '${po.billstatus}' != "0"){
			return false;
		}else{
		grid.deleteSelectedRow();
		}
	}
	
	function exportAP(){
		var id=$("#id").val();
		if(id!=""){
			var path = basic_Url+"/exportExcel.do?id="+id;
	   		window.open(path,"_blank");
		}
		else{
			$.dialog.alert("请先保存再导出");
		}
	}
    
	/*计算两个日期之间的天数（含当天）*/
	function daysBetween(DateOne,DateTwo)
	{   
	    var OneMonth = DateOne.substring(5,DateOne.lastIndexOf ('-'));  
	    var OneDay = DateOne.substring(DateOne.length,DateOne.lastIndexOf ('-')+1);  
	    var OneYear = DateOne.substring(0,DateOne.indexOf ('-'));  
	  
	    var TwoMonth = DateTwo.substring(5,DateTwo.lastIndexOf ('-'));  
	    var TwoDay = DateTwo.substring(DateTwo.length,DateTwo.lastIndexOf ('-')+1);  
	    var TwoYear = DateTwo.substring(0,DateTwo.indexOf ('-'));  
	  
	    var days=((Date.parse(TwoMonth+'/'+TwoDay+'/'+TwoYear) - Date.parse(OneMonth+'/'+OneDay+'/'+OneYear))/86400000)+1;  //包含当天
	    return days;
	}
	//采购预览打印
	function PrintView(type){
		if(type==1){
			window.parent.parent.loadPrint(obj,getNeedData(grid.getData()),"purchaseware",false);
		}else{
			window.parent.parent.loadPrint(obj,getNeedData(grid.getData()),"purchaseware",true);
		}
	}
	function getNeedData(data){
		var arr= new Array();
		for(var i=0;i<data.length;i++){
			if(isNaN(data[i].zd020BackQuantity)){
				data[i].zd018HsQuantity=parseFloat(data[i].zd018HsQuantity)-parseFloat(data[i].zd020BackQuantity)
			}
			if(parseFloat(data[i].zd018HsQuantity)!=0){
				arr.push(data[i]);
			}
		}
		return arr;
	}
	function deleteBackIn(){
	 	$.ajax({
			url:"${ctx}/logic/purchase/deleteBack.do",
			global:false,
			type:"POST",
			dataType:"json",
			data:({
				id:$("#zd001PcsId").val()
			}),
			success:function(msg){
				if(msg.msg=="no"){
					$.dialog.alert("您选择的采购订单已有货物入库，不能删除此单据");
				}else{
					var api = frameElement.api;
					//刷新主表页面
					var W = api.opener;
		        	W.searchAP();
					$.dialog.alert("驳回成功");
					//关闭本页面
					 api.close();
				}
			}
		});
	}
</script>
</head>
<body>
<form id="inputForm" action="" method="post">
<input type="hidden" id="id" name="id" value="${pcsware.id}"/>
<input type="hidden" id="bizVersion" name="bizVersion" value="${pcsware.bizVersion}"/>
<input type="hidden" id="itemdata" name="itemdata" value=""/>
<input type="hidden" id="itemdelete" name="itemdelete" value=""/>
<input type="hidden" id="flagMark" name="flagMark" value=""/>
<!-- 用于标识提交按钮 -->
<input type="hidden" id="submitFlag" value="" />
	<div class="pageContent" >
    	<div class="panel">
        	<table class="TableBlock" align="center">
            	<tr>
            		<c:choose>
	                	<c:when test="${empty pcsware.zd002PcsCode}">
	                    	<td nowrap>采购编号:</td>
		                    <td>
		   		             	<input type="hidden" id="zd001PcsId" name="zd001PcsId" />
	   		                 	<input type="text" style="width:200px;" id="zd002PcsCode"  name="zd002PcsCode" ></input>
   		        				<input type="button" value="..." onclick="PurchaseReturnWindow();" />
		   		           	</td>
		   		            <td colspan="2"></td>
	                    </c:when>
	                    <c:otherwise>
	                    	<td nowrap>采购入库单号:</td>
	   		                <td>
	   		                	<input type="text" id="zd003Code" name="zd003Code" readonly="readonly" class="required  inp_width_98p" value="${pcsware.zd003Code }" />
	   		                </td>
	                    	<td nowrap>采购编号:</td>
		                    <td colspan="3">
		                    	<input type="hidden" id="zd001PcsId" name="zd001PcsId" value="${pcsware.zd001PcsId }"/>
		   		            	<input type="text" id="zd002PcsCode" name="zd002PcsCode" value="${pcsware.zd002PcsCode}" class="inp_width_98p" readonly="readonly"/>
		   		            </td>
	                   	</c:otherwise>
	              	</c:choose>
   		        </tr>
   		        <tr>
   		        <td nowrap>送货单号:</td>
   		        	<td>
   		        		<input type="text" id="zd017MaterialInCode" name="zd017MaterialInCode"  class="required inp_width_98p" value="${pcsware.zd017MaterialInCode }" />
   		        	</td>
   		        	<td colspan="2"></td>
   		        </tr>
   		        <tr>
   		        	<td nowrap>采购方式:</td>
   		            <td>
   		            	<input type="text" id="zd015BuyWay" name="zd015BuyWay"  class="required inp_width_98p" value="${pcsware.zd015BuyWay }" readonly="readonly"/>
   		            </td>
   		             <td nowrap>PI编号:</td>
   		            <td>
   		            	<input type="text" id="zd016PiCode" name="zd016PiCode"  class="inp_width_98p" value="${pcsware.zd016PiCode }" readonly="readonly"/>
   		            </td>
   		       	</tr>
   		       	 <tr>
   		        	<td nowrap>客户编号:</td>
   		            <td>
   		            	<input type="text" id="zd019AccountCode" name="zd019AccountCode"  class="inp_width_98p" value="${pcsware.zd019AccountCode }" />
   		            	<input type="hidden" id="zd019AccountID" name="zd019AccountID"  class="inp_width_98p" value="${pcsware.zd019AccountID }" />
   		            </td>
   		             <td nowrap>客户名称:</td>
   		            <td>
   		            	<input type="text" id="zd019AccountName" name="zd019AccountName"  class="inp_width_98p" value="${pcsware.zd019AccountName }" />
   		            </td>
   		       	</tr>
   		        <tr>
   		        	<td nowrap>供应商:</td>    
                    <td>
                    	<input type="hidden" id="zd008SupeId" name="zd008SupeId" value="${pcsware.zd008SupeId }"/>
                    	<input type="hidden" id="zd008SupeCode" name="zd008SupeCode" value="${pcsware.zd008SupeCode }"/>
                    	<input type="text" id="zd008SupeName" name="zd008SupeName" class="required  inp_width_98p"  value="${pcsware.zd008SupeName}" readonly="readonly"/>
                    </td>
   		           	<td nowrap>入库仓库:</td>
                    <td>
                    	<c:choose>
                    		<c:when test="${empty pcsware.zd002PcsCode }">
                    		 <input type="hidden" style="width:200px;" id="zd005WhId" name="zd005WhId" value="${pcsware.zd005WhId }" />
                    		 <input type="hidden" id="zd006WhCode" name="zd006WhCode" value="${pcsware.zd006WhCode }"/>
   		              		 <input type="text" id="zd007WhName" name="zd007WhName" value="${pcsware.zd006WhName }" class="required"/>
   		        		     <input type="button" value="..." onclick="SotrageinfoWindow();" />
                    		</c:when>
                    		<c:otherwise>
                    			<input type="text" id="zd007WhName" name="zd007WhName" readonly="readonly" class="required  inp_width_98p" value="${pcsware.zd007WhName }" />
                    			<input type="hidden" id="zd005WhId" name="zd005WhId" value="${pcsware.zd005WhId }"/>
                    			<input type="hidden" id="zd006WhCode" name="zd006WhCode" value="${pcsware.zd006WhCode }"/>
                    		</c:otherwise>
                    	</c:choose>
   		           	</td>	
   		        </tr>
   		        <tr>
   		        	<td nowrap>验收人:</td>
                   	<td>
                   		<input type="text" id="zd011Atten" name="zd011Atten"  class="required  inp_width_98p" value="${pcsware.zd011Atten }"  />
                   	</td>
                   	<td nowrap>入库日期:</td>
                 	<td>
                		<input type="text" id="zd013Date" name="zd013Date"  onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="required  inp_width_98p" value="<fmt:formatDate value="${pcsware.zd013Date}" pattern="yyyy-MM-dd" type="both" />"  readonly="readonly"/>
                 	</td>
   		        </tr>
   		        <tr>
   		        	<td>支付方式:</td>
   		           	<td>
   		           		<input type="hidden"  id="zd009PayId" name="zd009PayId"  value="${pcsware.zd009PayId }"/>
   		           		<input type="hidden"  id="zd009PayCode" name="zd009PayCode"   value="${pcsware.zd009PayCode }"/>
   		           		<input type="text"  id="zd009PayName" name="zd009PayName" class="inp_width_98p"  value="${pcsware.zd009PayName}"  readonly="readonly"/>
   		           	</td>
   		        	<td>采购部门:</td>
   		           	<td>
   		           		<input type="hidden"  id="zd010DeptId" name="zd010DeptId"  value="${pcsware.zd010DeptId }"/>
   		           		<input type="hidden"  id="zd010DeptCode" name="zd010DeptCode"   value="${pcsware.zd010DeptCode }"/>
   		           		<input type="text"  id="zd010DeptName" name="zd010DeptName" class="inp_width_98p"  value="${pcsware.zd010DeptName}"  readonly="readonly"/>
   		           	</td>
   		        </tr>
   		        <tr>
					<td nowrap>制单人:</td>
   		            <td>
   		            	<c:choose>
   		            		<c:when test="${flag=='ADD' }">
   		            			<input type="text" id="bizCreatorName" name="bizCreatorName" class="required inp_width_98p"  value="${user.name }" readonly="readonly"/>
   		            		</c:when>
   		            		<c:otherwise>
   		            			<input type="text" id="bizCreatorName" name="bizCreatorName" class="required inp_width_98p"  value="${pcsware.bizCreatorName }" readonly="readonly"/>
   		            		</c:otherwise>
   		            	</c:choose>
   		            </td>
   		        	<td>总金额:</td>
   		        	<td>
   		        		<input type="text" id="zd018TheSumMoney" name="zd018TheSumMoney" class="required inp_width_98p" value="${pcsware.zd018TheSumMoney }" readonly="readonly"/>
   		        	</td>
   		        </tr>
   		        <tr>
 		        	<td>备注:</td>
 		           	<td colspan="3"><input id="zd014Remark" class="inp_width_98p" name="zd014Remark" value="${pcsware.zd014Remark }" /></td>
 		        </tr>
           	</table>
            <div id="table1"></div> 
         </div>
		<div class="formBar">
	    	<ul>
	        	<li><div class="button"><div class="buttonContent"><button type="button" id="forExcel" class="export" onclick="exportAP()">导出</button></div></div> </li>
		       	<li><div class="buttonActive"><div class="buttonContent"><button type="button" id="forSave" onclick="submitForm('PCSW_SAVE')">保存</button></div></div></li>
		       	<li><div class="buttonActive"><div class="buttonContent"><button type="button" id="forSubmit" onclick="submitForm('PCSW_SUBMIT')">直接提交</button></div></div></li>
		       	<webres:displaycontroller elementId="CGPOWARE_BH_CHEECK_PH" description="采购入库驳回">
		       		<li><div class="buttonActive"><div class="buttonContent"><button type="button" id="forBack" onclick="submitForm('PCSW_BACK')">驳回</button></div></div></li>
		      	</webres:displaycontroller>
		      	<webres:displaycontroller elementId="BACK_SALES_NOT_IN_STORE" description="驳回未入库的采购订单">
		       		<li><div class="buttonActive"><div class="buttonContent"><button type="button" id="deleteBack" onclick="deleteBackIn()">驳回未入库的采购订单</button></div></div></li>
		      	</webres:displaycontroller>
		       	<webres:displaycontroller elementId="CGPOWARE_YJ_CHEECK" description="采购入库二级审核">
		       		<li><div class="buttonActive"><div class="buttonContent"><button type="button" id="forAudit" onclick="submitForm('PCSW_AUDIT')">二级审核</button></div></div></li>
		       		<li><div class="buttonActive"><div class="buttonContent"><button type="button" id="forAuditEnd" onclick="submitForm('PCSW_APPROVE')">二级审核完结</button></div></div></li>
		      	</webres:displaycontroller>
		      	<webres:displaycontroller elementId="CGPOWARE_EJ_CHEECK" description="采购入库三级审核">
		       		<li><div class="buttonActive"><div class="buttonContent"><button type="button" id="forApproved" onclick="submitForm('PCSW_APPROVE')">三级审核</button></div></div></li>
		      	</webres:displaycontroller>
		      	<li id="print1"><div class="buttonActive"><div class="buttonContent"><button type="button" id="forPrint" onclick="PrintView(1);">打印预览</button></div></div></li>
		      	<li id='print2'><div class="buttonActive"><div class="buttonContent"><button type="button" id="forPrint" onclick="PrintView(2);">打印</button></div></div></li>
		       	<li><div class="button"><div class="buttonContent"><button type="button" class="print" onclick="CloseDialog()">关闭</button></div></div></li>
	        </ul>
        </div>
    </div>
</form>
</body>
</html>
